home *** CD-ROM | disk | FTP | other *** search
/ Nebula 1 / Nebula One.iso / Utilities / Converters / Convert_MacPaint / Source / shared.subproj / RCS / generalTypes.h,v < prev    next >
Text File  |  1995-06-12  |  5KB  |  197 lines

  1. head     1.2;
  2. branch   ;
  3. access   ;
  4. symbols  ;
  5. locks    ;
  6. comment  @ * @;
  7.  
  8.  
  9. 1.2
  10. date     92.04.27.20.33.13;  author death;  state Exp;
  11. branches ;
  12. next     1.1;
  13.  
  14. 1.1
  15. date     92.02.09.18.41.40;  author death;  state Exp;
  16. branches ;
  17. next     ;
  18.  
  19.  
  20. desc
  21. @This file contains various general data types that various applications are apt to use.
  22. This includes such things as bits16, to be sure you're getting a 16 bit quantity.
  23. @
  24.  
  25.  
  26. 1.2
  27. log
  28. @miscelaneous changes
  29. @
  30. text
  31. @/*
  32. ====================================================================
  33. This file declares several data types that varoious applications may wish to use.
  34.     This is $Revision: 1.1 $ of this file
  35.     It was last modified by $Author: death $ on $Date: 92/02/09 18:41:40 $
  36. Note that this file was created while using the New Century Schoolbook Roman typeface.  You may find that some things line up strangely if you don't use that family.
  37. $Log:    generalTypes.h,v $
  38.  * Revision 1.1  92/02/09  18:41:40  death
  39.  * Initial revision
  40.  * 
  41. ====================================================================
  42. */
  43.  
  44. #import <objc/objc.h>
  45.  
  46. //
  47. //    Draft 1 of standard types.  I can see this is a small step towards making everything an
  48. //    object. But, we'll see how we like what we have.  I'm a bit bothered by Cstring, for now,
  49. //    but...
  50. //
  51. //     Integer should be the largest available signed intergral number on the system.
  52. //    It is capitalized and fully spelled to help distnguish from normal int's in C.
  53. //    Naturally, PositiveInteger is it's unsigned counterpart.  Note that PositiveInteger,
  54. //    despite it's name, does include 0! =)
  55. //
  56. typedef     long int    Integer;
  57. typedef    unsigned long int    PositiveInteger;
  58. //
  59. //    Character is used to represent a letter, digit, or symbol on the local system.  It makes no
  60. //    pretenses at being able to deal with an ideographic, or potentially even a sylabic writing
  61. //    system.  In general, it should not be used as a number
  62. //
  63. typedef    unsigned char    Character;
  64. //
  65. //    Cstring is a special case, since one just ends up using pointers to chars frequently.
  66. //
  67. typedef    char*    CString;
  68. //
  69. //    id is all well and good, but let's be a bit more general and readable.  So, we define
  70. //    Object to be a reference to an object
  71. //    NOTE: Seems I can't call it Object bcause there is already a class called Object (oops).
  72. //    Naming it thus Objekt, which will allow easier search and replaces later when I think
  73. //    of a better name (in many cases, Object is implicit, so it need not be stated).  In any
  74. //    case, it brings to my attention that if I had to redefine any of these, the search and
  75. //    replace process would be messy...
  76. //
  77. typedef     id    Objekt;
  78. //
  79. //    Pointer is a reference to an untyped pointer.
  80. //
  81. typedef    void*    Pointer;
  82. //
  83. //    Boolean is, of course, a type for storing true or false values.  no others (undefined, etc)
  84. //
  85. typedef    BOOL    Boolean;
  86. //
  87. //    GenericType is used to store any of the preceeding types.
  88. //
  89. typedef union
  90. {
  91.     Integer        integer;
  92.     PositiveInteger    positiveinteger;
  93.     Character    character;
  94.     CString        cstring;
  95.     Objekt        object;
  96.     Pointer        pointer;
  97.     Boolean        boolean;
  98. }
  99. GenericType;
  100. //
  101. //    DataType is used to store any of the primary data types here, like GenericType, but
  102. //    also to record which type is stored, and thus allow for some type checking by the
  103. //    programmer.
  104. //
  105. typedef struct
  106. {
  107.     GenericType    data;
  108.     Integer        type;
  109. }
  110. DataType;
  111. //
  112. //    Now, define some values that correspond to thse types...
  113. //
  114. //    (Ahh, for C++'s ability to define constants...)
  115. //
  116. #define    CARRIGERETURN        0x13
  117. #define    LINEFEED                0x10
  118. #define    NEWLINE                0x10
  119. #define    TAB                        0x09
  120. //#define    NULL                    0x00    /* already defined, I believe */
  121. #define    ESCAPE                    0x1B    
  122. //
  123. //    Cstring definitions
  124. //
  125. #define    NullCString    (CString) 0x00
  126. #define    CStringEnd    (char) 0x00
  127. //
  128. //    Object definitions
  129. //    (nil is defined as part of Objective c.  note that casing! Nil is a nil Class structure).
  130. //
  131. #define    NullObject    nil
  132. //
  133. //    Pointer definitions
  134. //
  135. #define    NullPointer    0x00
  136. //
  137. //    Boolean definitions.
  138. //
  139. //#define    YES        /* Defined by Objective C.  uncomment if this changes or this moves*/
  140. //#define    NO        /* Defined by Objective C.  uncomment if this changes or this moves*/
  141. #define    True    YES
  142. #define    False    NO
  143. //
  144. //    Define constants for use in the DataType struct
  145. //
  146. #define    TYPE_NONE                0
  147. #define    TYPE_INTEGER            1
  148. #define    TYPE_POSITIVEINTEGER    2
  149. #define    TYPE_CHARACTER        3
  150. #define    TYPE_CSTRING            4
  151. #define    TYPE_OBJECT            5
  152. #define    TYPE_POINTER            6
  153. #define    TYPE_BOOLEAN            7
  154.  
  155. //
  156. //    Define some types. 
  157. //    These can all be considered as special cases of PositiveInteger, below.
  158. //
  159. typedef    unsigned char        Byte;
  160. typedef    unsigned char        bits8;
  161. typedef    unsigned short int    bits16;
  162. typedef    unsigned int            bits32;
  163. typedef    Byte*                ByteString;
  164. typedef    Integer                ErrorCode;
  165. @
  166.  
  167.  
  168. 1.1
  169. log
  170. @Initial revision
  171. @
  172. text
  173. @d4 2
  174. a5 2
  175.     This is $Revision$ of this file
  176.     It was last modified by $Author$ on $Date$
  177. d7 4
  178. a10 1
  179. $Log$
  180. d14 2
  181. d17 3
  182. a19 1
  183. // Define a type to be used so one needn't always type char*
  184. d21 103
  185. a123 1
  186. typedef    char*    Cstring;
  187. a124 1
  188.  
  189. d126 2
  190. a127 1
  191. // Define some binary types
  192. d129 1
  193. d133 2
  194. a134 1
  195.  
  196. @
  197.